package com.ivan.user.controller.api;

import com.ivan.common.result.Result;
import com.ivan.model.vo.user.LoginVo;
import com.ivan.user.service.UserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/*
 * @Author      Ivan
 * @Date        2023/4/6 14:27
 * @Description UserInfoController
 */
@Api(tags = "前台用户信息管理接口")
//@CrossOrigin//使用gateway后做了配置
@RestController
@RequestMapping("/front/user")
public class FrontUserController {

    @Autowired
    private UserInfoService userInfoService;

    @ApiOperation(value = "前台系统登录")
    @PostMapping("/login")
    public Result loginFront(@RequestBody LoginVo loginVo) {
        Map<String, Object> info = userInfoService.login(loginVo);
        return Result.ok(info);
    }
}
